home *** CD-ROM | disk | FTP | other *** search
- (*----------------------------------------------------------------------*)
- (* PIBDUMBT.PAS --- Emulate Dumb Terminal for PIBTERM *)
- (*----------------------------------------------------------------------*)
- (* *)
- (* Author: Philip R. Burns *)
- (* Version: 1.0 (January, 1985) *)
- (* 2.0 (June, 1985) *)
- (* Systems: For MS-DOS on IBM PCs and close compatibles only. *)
- (* Note: I have checked these on Zenith 151s under *)
- (* MSDOS 2.1 and IBM PCs under PCDOS 2.0. *)
- (* *)
- (* Needs: The Menu routines from PIBMENUS.PAS, communications *)
- (* routines from PIBASYNC.PAS, and various global variables *)
- (* from PIBTERM.PAS. *)
- (* *)
- (* History: Original with me. *)
- (* *)
- (* Suggestions for improvements or corrections are welcome. *)
- (* Please leave messages on Gene Plantz's BBS (312) 882 4145 *)
- (* or Ron Fox's BBS (312) 940 6496. *)
- (* *)
- (* If you use this code in your own programs, please be nice *)
- (* and give proper credit. *)
- (* *)
- (*----------------------------------------------------------------------*)
-
- OVERLAY PROCEDURE Emulate_Dumb_Terminal;
-
- (*----------------------------------------------------------------------*)
- (* *)
- (* Procedure: Emulate_Dumb_Terminal *)
- (* *)
- (* Purpose: Controls dumb terminal emulation *)
- (* *)
- (* Calling Sequence: *)
- (* *)
- (* Emulate_Dumb_Terminal; *)
- (* *)
- (* Calls: Async_Send *)
- (* Async_Receive *)
- (* KeyPressed *)
- (* Process_Command *)
- (* Display_Character *)
- (* ClrScr *)
- (* Async_Buffer_Full *)
- (* *)
- (* Remarks: *)
- (* *)
- (* You can replace this with something smarter --- i.e., *)
- (* a VT100 emulator, or whatever you like. *)
- (* *)
- (*----------------------------------------------------------------------*)
-
- VAR
- Done: BOOLEAN (* TRUE to exit terminal emulation mode *);
- Ch : CHAR (* Character read/written *);
-
- BEGIN (* Emulate_Dumb_Terminal *)
-
- Save_Screen( Saved_Screen );
- Draw_Menu_Frame( 10, 10, 55, 15, Menu_Frame_Color,
- Menu_Text_Color, '' );
-
- WRITELN('Beginning Dumb Terminal Emulation');
- DELAY( One_Second_Delay );
-
- Restore_Screen( Saved_Screen );
- Reset_Global_Colors;
-
- Auto_Wrap_Mode := TRUE;
- Done := FALSE;
- (* Loop over input until done *)
- WHILE ( NOT Done ) DO
- BEGIN
- (* Check for character typed at keyboard *)
- IF KeyPressed THEN
- BEGIN
-
- READ( Kbd , Ch );
-
- CASE ORD( Ch ) OF
-
- ESC: IF KeyPressed THEN
- BEGIN
- Process_Command( Ch, FALSE, PibTerm_Command );
- IF PibTerm_Command <> Null_Command THEN
- Execute_Command( PibTerm_Command, Done, FALSE );
- END
- ELSE
- BEGIN
- IF Local_Echo THEN WRITE( Ch );
- Async_Send( Ch );
- END;
-
- BS: BEGIN
- Ch := BS_Char;
- IF Local_Echo THEN WRITE( Ch );
- Async_Send( Ch );
- END;
-
- DEL: BEGIN
- Ch := Ctrl_BS_Char;
- IF Local_Echo THEN WRITE( Ch );
- Async_Send( Ch );
- END;
-
- ELSE
- BEGIN
- IF Local_Echo THEN WRITE( Ch );
- Async_Send( Ch );
- END;
-
- END (* CASE ORD( Ch ) *);
-
- END;
-
- IF ( Script_File_Mode AND ( NOT ( Done OR Really_Wait_String ) ) ) THEN
- BEGIN
- Get_Script_Command( PibTerm_Command );
- Execute_Command ( PibTerm_Command , Done , TRUE );
- END;
-
- IF Async_Receive( Ch ) THEN
- BEGIN
- (* Check if XOFF needs to be sent *)
- Async_Buffer_Full;
-
- (* Display the character received *)
-
- Display_Character( TrTab[Ch] );
-
- END;
-
- END;
-
- END (* Emulate_Dumb_Terminal *);